package cn.edu.sjtu.user_management.model;

import lombok.*;
import lombok.experimental.Tolerate;
import org.springframework.data.mongodb.core.mapping.Document;

import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;

@Builder
@Data
@Document(collection = "user")
public class User {

    private String id;
    @NotBlank
    private String userId; // 工号
    @NotBlank
    private String username;
    @NotBlank
    private String password;
    @NotNull
    @Min(value = 0)
    @Max(value = 3)
    private Integer role;
    @NotBlank
    private String phone;

    @Tolerate
    User() {
    }

}
